﻿// 动态检索数据combo
Ext.define('Kwan.ex.SearchCombo', {
    extend: 'Ext.form.field.ComboBox',
    alias: 'widget.Kwan.ex.SearchCombo',
    displayField: 'NameCN',
    typeAhead: false,
    hideTrigger: true,
    anchor: '100%',
    listConfig: {
        loadingText: 'Searching...',
        emptyText: 'No matching posts found.',
        getInnerTpl: function () {
            return '<a class="search-item" href="">' +
                        '<h3><span>{NameCN}<br />by {NameCN}</span>{Price}</h3>' +
                        '{excerpt}' +
                    '</a>';
        }
    },
    pageSize: 10,
    initComponent: function () {
        this.store = Ext.create('Ext.data.Store', {
            autoLoad: true,
            pageSize: this.pageSize,
            remoteSort: true,
            remoteFilter: true,
            //groupField: 'OrderID',
            fields: ['NameCN', 'Price'],
            sorters: [{ property: 'EntityID', direction: 'DESC'}],
            proxy: { type: 'ajax', url: 'facade.axd?s_action=Product&s_method=list', reader: { type: 'json', root: 'data.data', totalProperty: 'data.total'} }
        });
        this.callParent(arguments);
    }
});